package com.cz.nongyetongv5.utils;

import android.util.Log;

import com.cz.nongyetongv5.bean.HttpBack;
import com.cz.nongyetongv5.bean.User;

import org.apache.http.HttpResponse;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntity;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.params.CoreConnectionPNames;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;

import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.ProtocolException;
import java.net.SocketTimeoutException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
 
 
public class HttpUtilsEx {

	/**
	 * 娑撳﹣绱讹拷灞惧灇
	 */
	public static final int SUCCESS = 200;

	/**
	 * 娑撳﹣绱堕惃鍕秹缂佹粓鏁婄拠锟�
	 */
	public static final int NETWORK_ERR = -1;

	/**
	 * 娑撳﹣绱剁搾鍛
	 */
	public static final int TIMEOUT = -2;

	/**
	 * 閺堫亞鐓￠柨娆掝嚖
	 */
	public static final int UNKNOWERROR = -3;

	/**
	 * 姒涙顓婚惃鍒arset
	 */
	private static final String CHARSET = "UTF-8";

	private static final int TIMEOUT_CONFIG = 60 * 1000;

	/**
	 * 瑜版捁顕Ч鍌氱暚閹存劕锟�
	 */
	public interface OnRequestExecuted {

		public void onRequestExecuted(int responseCode, String responseBody);
	}

	private static HttpUtils httpUtils;

	private OnRequestExecuted onRequestExecuted;

	public HttpUtilsEx() {

	}

	/**
	 * 閸楁洑绶ュΟ鈥崇础閼惧嘲褰囨稉濠佺炊瀹搞儱锟�
	 * 
	 * @return
	 */
	public static HttpUtils getInstance() {
		if (null == httpUtils) {
			httpUtils = new HttpUtils();

		}
		return httpUtils;
	}

	/**
	 * 鐠佸墽鐤嗘稉濠佺炊鐎瑰本鍨氶崥搴ｆ畱閸ョ偠鐨熼崙鑺ユ殶
	 */
	public void setOnRequestExecuted(OnRequestExecuted onRequestExecuted) {
		this.onRequestExecuted = onRequestExecuted;
	}

	/**
	 * 
	 * @param requestUrl
	 *            閿涳拷鐠囬攱鐪伴崷鏉挎絻
	 * @param params
	 *            : 閸欏倹锟�
	 * @param method
	 *            : 鐠囬攱鐪伴惃鍕煙瀵拷
	 * @param charset
	 *            : 缂傛牜锟�
	 * @param authUserName
	 *            : 妤犲矁鐦夐弬鐟扮础閻ㄥ嫮鏁ら幋宄版倳
	 * @param authPassword
	 *            : 妤犲矁鐦夐弬鐟扮础閻ㄥ嫬鐦戦惍锟�
	 * @return
	 * @throws IOException
	 */
	public void sendRequest(String requestUrl, String data, String method,
			String charset, String authUserName, String authPassword, User user) {

		// 婵″倹鐏塩harset 閺勵垳鈹栭惃锟�
		if (!CharsetUtil.isNotNull(data)) {
			// 鐠佸墽鐤嗘稉娲帛鐠併倗娈慶harset
			charset = CHARSET;
		}

		// 閼惧嘲绶県ttpClient鐎电锟�
		DefaultHttpClient client = new DefaultHttpClient();

		client.getParams().setParameter(
				CoreConnectionPNames.CONNECTION_TIMEOUT, TIMEOUT_CONFIG);

		client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
				TIMEOUT_CONFIG);

		// 鐠囬攱鐪帮拷纭呰杽
		HttpUriRequest request = null;

		// 閸濆秴绨诧拷纭呰杽
		HttpResponse response = null;

		int requestCode = HttpUtils.UNKNOWERROR;

		// 閺堝秴濮熼崳銊ㄧ箲閸ョ偟娈戦弫鐗堝祦
		String responseBody = null;

		try {

			if (authUserName != null && authPassword != null) {

				// 鐠佸墽鐤嗙拋銈堢槈
				Credentials defaultcreds = new UsernamePasswordCredentials(
						authUserName, authPassword);

				client.getCredentialsProvider().setCredentials(AuthScope.ANY,
						defaultcreds);

			}

			// 婵″倹鐏夐弰鐥痮st鐠囬攱锟�
			if ("post".equalsIgnoreCase(method)) {

				request = new HttpPost();

				((HttpPost) request).setURI(new URI(requestUrl));

				// 鐠佸墽鐤嗛崣鍌涙殶
				((HttpPost) request).setHeader("Content-Type",
						"application/json");

				StringEntity entity = new StringEntity(data, charset);

				((HttpPost) request).setEntity(entity);

			} else {
				// get閺傜懓绱＄拠閿嬬湴
				request = new HttpGet();

				if (user != null) {

					if (authPassword != null && authUserName != null) {

						if (requestUrl.endsWith("/")) {

							requestUrl += "username/" + user.getUsername();

						} else {

							requestUrl += "/username/" + user.getUsername();
						}
					}

				} else {
					if (authPassword != null && authUserName != null) {
						if (requestUrl.endsWith("/")) {

							requestUrl += "username/zyz";

						} else {

							requestUrl += "/username/zyz";
						}
					}
				}

				if (authPassword != null && authUserName != null) {
					if (requestUrl.endsWith("/")) {

						requestUrl += "from/1";

					} else {

						requestUrl += "/from/1";
					}
				}

				((HttpGet) request).setURI(new URI(requestUrl));
			}

			if (request instanceof HttpGet) {

				// 閼惧嘲绶辨潻鏂挎礀鐎电锟�
				response = client.execute(((HttpGet) request));

			} else if (request instanceof HttpPost) {

				response = client.execute(((HttpPost) request));
			}

			// 鐟欙絾鐎界拠閿嬬湴缂傦拷
			requestCode = response.getStatusLine().getStatusCode();

			responseBody = EntityUtils.toString(response.getEntity());

		} catch (MalformedURLException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (ProtocolException e) {
			// Tcp 闁挎瑨锟�
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (SocketTimeoutException e) {
			// 鏉╃偞甯寸搾鍛閹垮秳锟�
			requestCode = HttpUtils.TIMEOUT;
		} catch (IOException e) {
			// IO 瀵倸锟�
			requestCode = HttpUtils.NETWORK_ERR;
		} catch (URISyntaxException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} finally {
			// 濞撳懐鎮婄挧鍕爱
			client.getConnectionManager().shutdown();
		}

		// 閹笛嗩攽閸ョ偠鐨熼崙鑺ユ殶
		if (onRequestExecuted != null) {
			onRequestExecuted.onRequestExecuted(requestCode, responseBody);
		}

	}
	
	
	
	public HttpBack sendRequest2(String requestUrl, String data, String method,
			String charset, String authUserName, String authPassword, User user) {
 
		if (!CharsetUtil.isNotNull(data)) {
			// 鐠佸墽鐤嗘稉娲帛鐠併倗娈慶harset
			charset = CHARSET;
		}

		// 閼惧嘲绶県ttpClient鐎电锟�
		DefaultHttpClient client = new DefaultHttpClient();

		client.getParams().setParameter(
				CoreConnectionPNames.CONNECTION_TIMEOUT,TIMEOUT_CONFIG);

		client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
				TIMEOUT_CONFIG);

		// 鐠囬攱鐪帮拷纭呰杽
		HttpUriRequest request = null;

		// 閸濆秴绨诧拷纭呰杽
		HttpResponse response = null;

		int requestCode = HttpUtils.UNKNOWERROR;

		// 閺堝秴濮熼崳銊ㄧ箲閸ョ偟娈戦弫鐗堝祦
		String responseBody = null;

		try {

			if (authUserName != null && authPassword != null) {

				// 鐠佸墽鐤嗙拋銈堢槈
				Credentials defaultcreds = new UsernamePasswordCredentials(
						authUserName, authPassword);

				client.getCredentialsProvider().setCredentials(AuthScope.ANY,
						defaultcreds);

			}

			// 婵″倹鐏夐弰鐥痮st鐠囬攱锟�
			if ("post".equalsIgnoreCase(method)) {

				request = new HttpPost();

				((HttpPost) request).setURI(new URI(requestUrl));

				// 鐠佸墽鐤嗛崣鍌涙殶
				((HttpPost) request).setHeader("Content-Type",
						"application/json");

				StringEntity entity = new StringEntity(data, charset);

				((HttpPost) request).setEntity(entity);

			} else {
				// get閺傜懓绱＄拠閿嬬湴
				request = new HttpGet();

				if (user != null) {

					if (authPassword != null && authUserName != null) {

						if (requestUrl.endsWith("/")) {

							requestUrl += "username/" + user.getUsername();

						} else {

							requestUrl += "/username/" + user.getUsername();
						}
					}

				} else {
					if (authPassword != null && authUserName != null) {
						if (requestUrl.endsWith("/")) {

							requestUrl += "username/zyz";

						} else {

							requestUrl += "/username/zyz";
						}
					}
				}

				if (authPassword != null && authUserName != null) {
					if (requestUrl.endsWith("/")) {

						requestUrl += "from/1";

					} else {

						requestUrl += "/from/1";
					}
				}

				((HttpGet) request).setURI(new URI(requestUrl));
			}

			if (request instanceof HttpGet) {

				// 閼惧嘲绶辨潻鏂挎礀鐎电锟�
				response = client.execute(((HttpGet) request));

			} else if (request instanceof HttpPost) {

				response = client.execute(((HttpPost) request));
			}

			// 鐟欙絾鐎界拠閿嬬湴缂傦拷
			requestCode = response.getStatusLine().getStatusCode();

			responseBody = EntityUtils.toString(response.getEntity());

		} catch (MalformedURLException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (ProtocolException e) {
			// Tcp 闁挎瑨锟�
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (SocketTimeoutException e) {
			// 鏉╃偞甯寸搾鍛閹垮秳锟�
			requestCode = HttpUtils.TIMEOUT;
		} catch (IOException e) {
			// IO 瀵倸锟�
			requestCode = HttpUtils.NETWORK_ERR;
		} catch (URISyntaxException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} finally {
			// 濞撳懐鎮婄挧鍕爱
			client.getConnectionManager().shutdown();
		}
		HttpBack back=new HttpBack();
		back.setCode(requestCode);
		back.setData(responseBody);
		return back;

	}
	
	public HttpBack sendRequest3(String requestUrl, String data) {
		 
		 
		 
		DefaultHttpClient client = new DefaultHttpClient();

		client.getParams().setParameter(
				CoreConnectionPNames.CONNECTION_TIMEOUT,TIMEOUT_CONFIG);

		client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
				TIMEOUT_CONFIG);
       
		// 鐠囬攱鐪帮拷纭呰杽
		HttpPost request = new HttpPost();

		// 閸濆秴绨诧拷纭呰杽
		HttpResponse response = null;

		int requestCode = HttpUtils.UNKNOWERROR;
 
		String responseBody = null;

		try {
			 
            request.setURI(new URI(requestUrl));

				// 鐠佸墽鐤嗛崣鍌涙殶
				((HttpPost) request).setHeader("Content-Type",
						" text/xml; charset=utf-8");

				StringEntity entity = new StringEntity(data,"utf-8");

				((HttpPost) request).setEntity(entity);

			  response = client.execute(((HttpPost) request));
		 
 
			requestCode = response.getStatusLine().getStatusCode();

			responseBody = EntityUtils.toString(response.getEntity());

		} catch (MalformedURLException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (ProtocolException e) {
			// Tcp 闁挎瑨锟�
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (SocketTimeoutException e) {
			// 鏉╃偞甯寸搾鍛閹垮秳锟�
			requestCode = HttpUtils.TIMEOUT;
		} catch (IOException e) {
			// IO 瀵倸锟�
			requestCode = HttpUtils.NETWORK_ERR;
		} catch (URISyntaxException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} finally {
			// 濞撳懐鎮婄挧鍕爱
			client.getConnectionManager().shutdown();
		}
		HttpBack back=new HttpBack();
		back.setCode(requestCode);
		back.setData(responseBody);
		return back;

	}
	public HttpBack sendRequest4(String requestUrl, String data) {
 
		 
 
		DefaultHttpClient client = new DefaultHttpClient();

		client.getParams().setParameter(
				CoreConnectionPNames.CONNECTION_TIMEOUT,TIMEOUT_CONFIG);

		client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
				TIMEOUT_CONFIG);
	 
		Credentials defaultcreds = new UsernamePasswordCredentials(
				"test", "1qaz2wsX");
        client.getCredentialsProvider().setCredentials(AuthScope.ANY,
				defaultcreds);

		// 鐠囬攱鐪帮拷纭呰杽
		HttpPost request = new HttpPost();

		// 閸濆秴绨诧拷纭呰杽
		HttpResponse response = null;

		int requestCode = HttpUtils.UNKNOWERROR;
 
		String responseBody = null;

		try {
			 Log.d("rafe sync url",requestUrl);
             request.setURI(new URI(requestUrl));
 
             ((HttpPost) request).setHeader("Content-Type",
						"application/json");
				StringEntity entity = new StringEntity(data,"utf-8");

				((HttpPost) request).setEntity(entity);

			  response = client.execute(((HttpPost) request));
		 
 
			requestCode = response.getStatusLine().getStatusCode();

			responseBody = EntityUtils.toString(response.getEntity());

		} catch (MalformedURLException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (ProtocolException e) {
			// Tcp 闁挎瑨锟�
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (SocketTimeoutException e) {
			// 鏉╃偞甯寸搾鍛閹垮秳锟�
			requestCode = HttpUtils.TIMEOUT;
		} catch (IOException e) {
			// IO 瀵倸锟�
			requestCode = HttpUtils.NETWORK_ERR;
		} catch (URISyntaxException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} finally {
			// 濞撳懐鎮婄挧鍕爱
			client.getConnectionManager().shutdown();
		}
		HttpBack back=new HttpBack();
		back.setCode(requestCode);
		back.setData(responseBody);
		return back;

	}
	
	
	
	public void sendRequest5(String requestUrl, String data, String method,
			String charset, String authUserName, String authPassword, User user) {

		// 婵″倹鐏塩harset 閺勵垳鈹栭惃锟�
		if (!CharsetUtil.isNotNull(data)) {
			// 鐠佸墽鐤嗘稉娲帛鐠併倗娈慶harset
			charset = CHARSET;
		}

		// 閼惧嘲绶県ttpClient鐎电锟�
		DefaultHttpClient client = new DefaultHttpClient();

		client.getParams().setParameter(
				CoreConnectionPNames.CONNECTION_TIMEOUT, TIMEOUT_CONFIG);

		client.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT,
				TIMEOUT_CONFIG);

		// 鐠囬攱鐪帮拷纭呰杽
		HttpUriRequest request = null;

		// 閸濆秴绨诧拷纭呰杽
		HttpResponse response = null;

		int requestCode = HttpUtils.UNKNOWERROR;

		// 閺堝秴濮熼崳銊ㄧ箲閸ョ偟娈戦弫鐗堝祦
		String responseBody = null;

		try {

			if (authUserName != null && authPassword != null) {

				// 鐠佸墽鐤嗙拋銈堢槈
				Credentials defaultcreds = new UsernamePasswordCredentials(
						authUserName, authPassword);

				client.getCredentialsProvider().setCredentials(AuthScope.ANY,
						defaultcreds);

			}

			// 婵″倹鐏夐弰鐥痮st鐠囬攱锟�
			if ("post".equalsIgnoreCase(method)) {

				request = new HttpPost();

				((HttpPost) request).setURI(new URI(requestUrl));

				// 鐠佸墽鐤嗛崣鍌涙殶
				((HttpPost) request).setHeader("Content-Type",
						"application/json");

				StringEntity entity = new StringEntity(data, charset);

				((HttpPost) request).setEntity(entity);

			} else {
				// get閺傜懓绱＄拠閿嬬湴
				request = new HttpGet();

				if (user != null) {

					if (authPassword != null && authUserName != null) {

						if (requestUrl.endsWith("/")) {

							requestUrl += "username/" + user.getUsername();

						} else {

							requestUrl += "/username/" + user.getUsername();
						}
					}

				} else {
					if (authPassword != null && authUserName != null) {
						if (requestUrl.endsWith("/")) {

							requestUrl += "username/zyz";

						} else {

							requestUrl += "/username/zyz";
						}
					}
				}

				if (authPassword != null && authUserName != null) {
					if (requestUrl.endsWith("/")) {

						requestUrl += "from/1";

					} else {

						requestUrl += "/from/1";
					}
				}

				((HttpGet) request).setURI(new URI(requestUrl));
			}

			if (request instanceof HttpGet) {

				// 閼惧嘲绶辨潻鏂挎礀鐎电锟�
				response = client.execute(((HttpGet) request));

			} else if (request instanceof HttpPost) {

				response = client.execute(((HttpPost) request));
			}

			// 鐟欙絾鐎界拠閿嬬湴缂傦拷
			requestCode = response.getStatusLine().getStatusCode();

			responseBody = EntityUtils.toString(response.getEntity());

		} catch (MalformedURLException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (ProtocolException e) {
			// Tcp 闁挎瑨锟�
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (SocketTimeoutException e) {
			// 鏉╃偞甯寸搾鍛閹垮秳锟�
			requestCode = HttpUtils.TIMEOUT;
		} catch (IOException e) {
			// IO 瀵倸锟�
			requestCode = HttpUtils.NETWORK_ERR;
		} catch (URISyntaxException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} finally {
			// 濞撳懐鎮婄挧鍕爱
			client.getConnectionManager().shutdown();
		}

		// 閹笛嗩攽閸ョ偠鐨熼崙鑺ユ殶
		if (onRequestExecuted != null) {
			onRequestExecuted.onRequestExecuted(requestCode, responseBody);
		}

	}
	 public   String replaceBlank(String str) {
	        String dest = "";
	        if (str!=null) {
	            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
	            Matcher m = p.matcher(str);
	            dest = m.replaceAll("");
	        }
	        return dest;
	    }
	public HttpBack sendRequestPic(String requestUrl, String data ) {

	   HttpBack data1=new HttpBack();
		data1.setCode(-500);
		data1.setData("error");
		HttpResponse response = null;

		int requestCode = HttpUtils.UNKNOWERROR;
		 HttpClient httpClient = new DefaultHttpClient();  
		// 閺堝秴濮熼崳銊ㄧ箲閸ョ偟娈戦弫鐗堝祦
		String responseBody = null;
  try{
	   
	    HttpContext localContext = new BasicHttpContext();  
	    HttpPost httpPost = new HttpPost(requestUrl);  
	  
	        MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);  
	                   entity.addPart("upfile", new FileBody(new File (data)));  
	        httpPost.setEntity(entity);  
	        response = httpClient.execute(httpPost, localContext);  
	   
		    requestCode = response.getStatusLine().getStatusCode();
		    data1.setCode(requestCode);
			responseBody = EntityUtils.toString(response.getEntity());
			data1.setData(replaceBlank(responseBody));

		} catch (MalformedURLException e) {
			// URL鐟欙絾鐎介柨娆掝嚖
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (ProtocolException e) {
			// Tcp 闁挎瑨锟�
			requestCode = HttpUtils.UNKNOWERROR;
		} catch (SocketTimeoutException e) {
			// 鏉╃偞甯寸搾鍛閹垮秳锟�
			requestCode = HttpUtils.TIMEOUT;
		} catch (IOException e) {
			// IO 瀵倸锟�
			requestCode = HttpUtils.NETWORK_ERR;
		} finally {
			// 濞撳懐鎮婄挧鍕爱 
			httpClient.getConnectionManager().shutdown();
		}

		// 閹笛嗩攽閸ョ偠鐨熼崙鑺ユ殶
		if (onRequestExecuted != null) {
			onRequestExecuted.onRequestExecuted(requestCode, responseBody);
		}
		return data1;

	}
	
	public HttpBack sendRequestPic_v1609(String requestUrl, String data) {

		   HttpBack data1=new HttpBack();
			data1.setCode(-500);
			data1.setData("error");
			HttpResponse response = null;

			int requestCode = HttpUtils.UNKNOWERROR;
			 HttpClient httpClient = new DefaultHttpClient();  
			// 閺堝秴濮熼崳銊ㄧ箲閸ョ偟娈戦弫鐗堝祦
			String responseBody = null;
	  try{
		   
		    HttpContext localContext = new BasicHttpContext();  
		    HttpPost httpPost = new HttpPost(requestUrl);  
		  
		        MultipartEntity entity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);  
		                   entity.addPart("filedata", new FileBody(new File (data)));  
		        httpPost.setEntity(entity);  
		        response = httpClient.execute(httpPost, localContext);  
		   
			    requestCode = response.getStatusLine().getStatusCode();
			    data1.setCode(requestCode);
				responseBody = EntityUtils.toString(response.getEntity());
				data1.setData(replaceBlank(responseBody));
				
				 Log.d("debugfile",requestCode+"");
                Log.d("debugfile",String.valueOf(responseBody));
			} catch (MalformedURLException e) {
				// URL鐟欙絾鐎介柨娆掝嚖
				requestCode = HttpUtils.UNKNOWERROR;
			} catch (ProtocolException e) {
				// Tcp 闁挎瑨锟�
				requestCode = HttpUtils.UNKNOWERROR;
			} catch (SocketTimeoutException e) {
				// 鏉╃偞甯寸搾鍛閹垮秳锟�
				requestCode = HttpUtils.TIMEOUT;
			} catch (IOException e) {
				// IO 瀵倸锟�
				requestCode = HttpUtils.NETWORK_ERR;
			} finally {
				// 濞撳懐鎮婄挧鍕爱 
				httpClient.getConnectionManager().shutdown();
			}

			// 閹笛嗩攽閸ョ偠鐨熼崙鑺ユ殶
			if (onRequestExecuted != null) {
				onRequestExecuted.onRequestExecuted(requestCode, responseBody);
			}
			return data1;

		}
}
